﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace Shcool.Models
{
    public class UserContext : DbContext
    {
        public DbSet<Student> Students { get; set; }
        public DbSet<Teacher> Teachers { get; set; }
        public DbSet<Course> Courses { get; set; }
        public DbSet<Score> Scores { get; set; }
        public DbSet<Level> Levels { get; set; }
        public DbSet<News> NewsItems { get; set; }
        public DbSet<StudentCourse> StudentCourses { get; set; }
        public DbSet<TeacherCourse> TeacherCourses { get; set; } 
        public DbSet<StudentScore> StudentScores { get; set; }
        public DbSet<StudentLevel> StudentLeves { get; set; } 

        static UserContext ( )
        {
            Database.SetInitializer ( new MyDbContextInitializer ( ) );
        }


    }

    public class MyDbContextInitializer : CreateDatabaseIfNotExists<UserContext>
    {
        protected override void Seed ( UserContext context )
        {
            // seed data
            // Ath. hér er hægt að skilgreina hvaða gögn eigi að vera inni í grunninum þegar hann verður búinn til.
            // Það er engin skylda að gera neitt hér frekar en þið viljið.

            base.Seed ( context );
        }
    }
}